package front

import (
	"fmt"
	"hft/Http/Services/front"
	utils "hft/Http/Utils"
	"strconv"

	"github.com/gin-gonic/gin"
)

type Site struct{}

// 获取所有的站点信息
func (*Site) GetAllSite(c *gin.Context) {

	city, _ := strconv.Atoi(c.DefaultQuery("sid", "0"))

	ip := c.ClientIP()

	fmt.Println(ip)

	list, err := front.SiteService.GetAllSite(city, ip)

	if err != nil {
		utils.FailWithMessage(err.Error(), c)
		return
	}

	utils.OkWithData(list, c)

}

var SiteController = new(Site)
